package y23.Sep;

public class Test5 {
    public static void main(String[] args) {
        Solution3 solution3 = new Solution3();
        int[] nums = {3,2,2,3};
        System.out.println(solution3.removeElement(nums,3));
        int[] nums2 = {0,1,2,2,3,0,4,2};
        System.out.println(solution3.removeElement(nums2,2));
    }
}
class Solution3 {
    public int removeElement(int[] nums, int val) {
        int count = 0;
        for(int i = 0; i < nums.length; i ++)
            if(nums[i]!=val)
                nums[count++]=nums[i];
        return count;
    }
}
